/*
 * @Author: hupaocai 13767071930@163.com
 * @Date: 2025-03-27 17:29:26
 * @LastEditors: hupaocai 13767071930@163.com
 * @LastEditTime: 2025-03-27 17:29:33
 * @FilePath: /banban-front/utils/auth.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

// 获取token
export const getToken = () => {
    return uni.getStorageSync('token') || ''
}

// 设置token
export const setToken = (token) => {
    uni.setStorageSync('token', token)
}

// 存储用户信息
export const setUserInfo = (info) => {
    uni.setStorageSync('userInfo', JSON.stringify(info))
}
// 获取用户信息
export const getUserInfo = () => {
    const infoStr = uni.getStorageSync('userInfo')
    const info = infoStr ? JSON.parse(infoStr) : { nickName: '', avatarUrl: '' }
    return info
}